package cn.mothin.frame.util;

import java.util.List;

import cn.mothin.frame.util.encrypt.MD5;

public class IconClassUtil {
	public static String makeIconClass(String ico) {
		if (StringUtil.isNullOrEmpty(ico)) {
			return null;
		}
		return "icon-" + MD5.makeMD5(ico);
	}

	public static String makeIconCss(List<String> icoList) {
		StringBuffer stringBuffer = new StringBuffer();
		for (String ico : icoList) {
			String icoCls = makeIconClass(ico);
			if (icoCls != null) {
				stringBuffer.append(".");
				stringBuffer.append(icoCls);
				stringBuffer.append("{");
				stringBuffer.append("background:url('");
				stringBuffer.append(ico);
				stringBuffer.append("') no-repeat center center;}");
			}
		}
		return stringBuffer.toString();
	}
}
